package com.lengxf.design;

import java.io.IOException;
import java.util.Hashtable;

public class PrototypeManager {

    private final static Hashtable<String, Prototype> protoTypeTable = new Hashtable<>();


    public static void add(String key, Prototype prototype) {
        protoTypeTable.put(key, prototype);
    }

    public static Prototype get(String key) throws IOException, ClassNotFoundException {
        Prototype prototype = protoTypeTable.get(key);
        return prototype.deepClone();
    }


}
